package myzd.utils;

import java.util.regex.Pattern;

/**
 * @author zks
 * @since 2017/10/31 18:10
 */
public class RegExpUtils {
  private static final String EMAIL_REGEX = "^\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+$";

  private static final String REGEX_MOBILE = "^((13[0-9])|(15[^4])|(18[0-9])|(17[0-8])|(147))\\d{8}$";

  public static boolean isEmail(String email) {
    return Pattern.matches(EMAIL_REGEX, email);
  }

  public static boolean isMobile(String mobile) {
    return Pattern.matches(REGEX_MOBILE, mobile);
  }
}
